Depression is a grave medical issue experienced by numerous individuals globally, leading to a continuous decline in one's mood and significantly impacting their emotions. This article explores the use of machine learning and BERT embeddings for detecting depression from text data and gender variable. We compare the accuracies of different machine learning algorithms, consisting of logistic regression(LR), support vector machines(SVM), and random forests(RF), on a benchmark dataset of DAIC_WOZ. We found that including gender information as a feature significantly improves the performance of the models. Specifically, logistic regression and random forests show higher accuracy in detecting depression when gender information is included. These findings suggest that BERT embeddings and gender information can be effective tools for detecting depression from text and highlight the potential of machine learning for mental health research with consideration of gender differences.